package com.ambercrm.business.location;

import android.os.Bundle;
import android.view.View;

import com.amap.api.maps.AMap;
import com.amap.api.maps.CameraUpdateFactory;
import com.amap.api.maps.MapView;
import com.amap.api.maps.model.LatLng;
import com.ambercrm.R;
import com.ambercrm.base.BaseTitleActivity;

public class CheckLocationActivity extends BaseTitleActivity {

    private AMap aMap;
    private MapView mapView;      // 地图View
    @Override
    protected int getContentLayoutId() {
        return R.layout.activity_check_location;
    }

    @Override
    protected void initContentView(View v) {
        mTitleText.setText("查看地址");
        mapView = v.findViewById(R.id.mapView);
        aMap = mapView.getMap();
        mapView.onCreate(mSavedInstanceState);// 此方法必须重写

        Bundle b = getBundle();
        double latitude = b.getDouble("latitude");
        double longitude = b.getDouble("longitude");

        LatLng latLng = new LatLng(latitude, longitude);
        aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 8));
    }

    @Override
    protected void onResume() {
        super.onResume();
        mapView.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
        mapView.onPause();
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        mapView.onSaveInstanceState(outState);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mapView.onDestroy();
    }
}